package frontend.model.admin;

import backend.model.admin.Shift;
import frontend.model.base.UIModel;

public class ShiftUIModel implements UIModel<Shift> {

    private String name;
    private String description;
    private boolean isActive;

    private Shift shift;

    public ShiftUIModel() {
        shift = new Shift();
        isActive = true;
    }

    public ShiftUIModel(Shift shift) {
        this.shift = shift;
        populateFieldsFromDBModel();
    }

    @Override
    public void populateFieldsFromDBModel() {
        name = shift.getName();
        description = shift.getDescription();
        isActive = shift.getIsActive();
    }

    @Override
    public void populateDBModelFromFields() {
        shift.setDescription(description);
        shift.setName(name);
        shift.setIsActive(isActive);
    }

    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }

    @Override
    public Shift getDBModel() {
        return shift;
    }
}
